package com.qing.eduservice.controller;


import com.qing.eduservice.entity.vo.VideoInfoVo;
import com.qing.eduservice.service.EduVideoService;
import com.qing.servicebase.utils.ResponseResult;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 课程视频 前端控制器
 * </p>
 *
 * @author Yjx
 * @since 2022-09-08
 */
@RestController
@RequestMapping("/eduservice/video")
public class EduVideoController {

    private final EduVideoService eduVideoService;

    public EduVideoController(EduVideoService eduVideoService) {
        this.eduVideoService = eduVideoService;
    }

    /**
     * 增加
     * @param videoInfoVo
     * @return
     */
    @PostMapping("/add")
    public ResponseResult save(@RequestBody VideoInfoVo videoInfoVo){
        return eduVideoService.saveVideoInfo(videoInfoVo);
    }

    /**
     *
     * @param id
     * @return
     */
    @GetMapping("/info/{id}")
    public ResponseResult getVideInfoById(@PathVariable String id){
        return eduVideoService.getVideoInfoFormById(id);
    }

    @PutMapping("/update/{id}")
    public ResponseResult updateCourseInfoById(@RequestBody VideoInfoVo videoInfoVo, @PathVariable String id){
        return eduVideoService.updateVideoInfoById(videoInfoVo);
    }

    @DeleteMapping("/delete/{id}")
    public ResponseResult removeById(@PathVariable String id){
        return eduVideoService.removeVideoById(id);
    }

}

